﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.Proxy.BuyTicket
{
    /// <summary>
    /// 代理处黄牛买票
    /// </summary>
    public class ProxyTicket : ITicket//继承
    {
        TicketCentre ticketCentre = new TicketCentre();//组合

        /// <summary>
        /// 买票
        /// </summary>
        public void BuyTicket()
        {
            Console.WriteLine($"{nameof(ProxyTicket)} Buy Ticket");
            AddMoney();
            ticketCentre.BuyTicket();
        }

        /// <summary>
        /// 查询票
        /// </summary>
        public void QueryTicket()
        {
            Console.WriteLine($"{nameof(ProxyTicket)} Query Ticket");
            ticketCentre.QueryTicket();
        }

        /// <summary>
        /// 加钱
        /// </summary>
        private void AddMoney() 
        {
            Console.WriteLine($"{nameof(ProxyTicket)} Add Money $10");
        }
    }
}
